<?php
define(EQUIPO,"127.0.0.1");
define(USUARIO,"root");
define(PASSW,""); 
$mysqli = new mysqli(EQUIPO, USUARIO, PASSW, "roller");
if($mysqli->connect_errno) {
    echo "Fallo al conectar: (ERROR: ".$mysqli->connect_errno.")";
}

$file = fopen("LISTA.TXT", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
$sql = "";
$i = 0;
while(!feof($file))
{
$string = fgets($file);
$sub = substr($string, 1, 17);
$orden = filter_var($sub, FILTER_SANITIZE_NUMBER_INT);
$precio = (float) substr($string, 32, 9);
$sql .= "INSERT INTO articulos (codigo, idMarca, orden, peso, precio, habilitado) VALUES ";
$sql .= "('$sub', '999', '$orden', '0', '$precio', '1');";
$i++;
}
fclose($file);
$mysqli->multi_query($sql);

$mysqli->close();
echo $sql;

?>